﻿Imports AutoCAD
''' <summary>
''' Cad应用服务
''' 【作用】
''' 1、获取进程中的CAD应用；
''' 2、获取当前激活的CAD文档；
''' 3、获取当前选中的图元集合；
''' 4、构建图层；
''' </summary>
Public Interface ICadApplicationService

    ''' <summary>
    ''' 激活wcs
    ''' </summary>
    Sub ActivationWCS()
    Sub ActivationWCS(ByRef doc As AcadDocument)

    ''' <summary>
    ''' 获取进程中的CAD应用程序
    ''' </summary>
    ''' <returns></returns>
    Function GetApplication() As AcadApplication

    ''' <summary>
    ''' 获取当前被激活的CAD文档
    ''' </summary>
    ''' <param name="app"> Cad应用程序 </param>
    ''' <returns></returns>
    Function GetActiveDocument(ByRef app As AcadApplication) As AcadDocument

    ''' <summary>
    ''' 获取当前被激活的CAD文档
    ''' </summary>
    ''' <returns></returns>
    Function GetActiveDocument() As AcadDocument

    ''' <summary>
    ''' 获取指定文档中已经被选中的图元集合
    ''' </summary>
    ''' <param name="doc"></param>
    ''' <returns></returns>
    Function GetCurrentSelectSet(ByRef doc As AcadDocument) As AcadSelectionSet

    ''' <summary>
    ''' 获取当前被激活的CAD文档中已经被选中的图元集合
    ''' </summary>
    ''' <returns></returns>
    Function GetCurrentSelectSet() As AcadSelectionSet

    ''' <summary>
    ''' 获取图元对象
    ''' </summary>
    ''' <returns></returns>
    Function GetEntity(ByRef doc As AcadDocument) As AcadEntity


    Function ObjectIdToObject(ByRef doc As AcadDocument, ByRef objectId As Long) As AcadEntity
    Function ObjectIdToObject(ByRef objectId As Long) As AcadEntity

    Function HandleToObject(ByRef doc As AcadDocument, ByRef handle As String) As AcadEntity
    Function HandleToObject(ByRef handle As String) As AcadEntity

    ''' <summary>
    ''' 获取图元对象
    ''' </summary>
    ''' <returns></returns>
    Function GetEntity() As AcadEntity

    ''' <summary>
    ''' 在指定文档中构建图层
    ''' </summary>
    ''' <param name="doc"></param>
    Sub BuildLayer(ByRef doc As AcadDocument)

    ''' <summary>
    ''' 在当前被激活的CAD文档中构建图层
    ''' </summary>
    Sub BuildLayer()

    ''' <summary>
    ''' 清楚垃圾
    ''' </summary>
    Sub PurgeAll(ByRef doc As AcadDocument)

    ''' <summary>
    ''' 清楚垃圾
    ''' </summary>
    Sub PurgeAll()


    ''' <summary>
    ''' 二维旋转坐标点
    ''' </summary>
    ''' <param name="vector"> 坐标点 </param>
    ''' <param name="angle"> 旋转角度 </param>
    ''' <returns></returns>
    Function Rotate2D(ByRef vector As Double(), angle As Double) As Double()


    ''' <summary>
    ''' 三维旋转坐标点(该方法已作废, 因为在仅做X轴旋转时会发生错误)
    ''' </summary>
    ''' <param name="vector"> 坐标点 </param>
    ''' <param name="angle"> 三个轴旋转角度 </param>
    ''' <returns></returns>
    Function Rotate3D(ByRef vector() As Double, angle As Double()) As Double()

    ''' <summary>
    ''' 三维旋转坐标点(该方法有效)
    ''' </summary>
    ''' <param name="vector"> 坐标点 </param>
    ''' <param name="angle"> 三个轴旋转角度 </param>
    ''' <returns></returns>
    Function Rotate3D2(ByRef vector() As Double, angle As Double()) As Double()


    ''' <summary>
    ''' 获取WCS
    ''' </summary>
    ''' <returns></returns>
    Function GetWCS(ByRef doc As AcadDocument) As AcadUCS
    ''' <summary>
    ''' 获取WCS
    ''' </summary>
    ''' <returns></returns>
    Function GetWCS() As AcadUCS

    ''' <summary>
    ''' 旋转坐标系
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <param name="angle"></param>
    ''' <returns></returns>
    Function RotateEntity(ByRef ent As AcadEntity, ByRef angle As Double()) As AcadEntity
End Interface
